<?php
function the_header() {
    if(file_exists(TMPPATH.'/header.php'))
        require_once TMPPATH.'/header.php';
}

function the_footer() {
    if(file_exists(TMPPATH.'/footer.php'))
        require_once TMPPATH.'/footer.php';
}

function redirect($location) {
    header('Location: '.SITE_URL.'/'.$location);
}

/** Blog Information **/
function bloginfo($name) {
    switch ($name) {
        case 'site_name':
            return SITE_NAME ;
            break;
        case 'site_path':
            return APSPATH;
            break;
        case 'site_url':
            return SITE_URL;
            break;
        case 'template_path':
            return APSPATH.'/themes/default';
            break;
        case 'template_url':
            return SITE_URL.'/themes/default';
            break;
    }

}

/** Load Files Require Once **/
function load($path) {
    $scan = scandir($path);

    foreach ($scan as $value) {
        if($value != '.' AND $value != '..' AND $value != 'index.php' AND $value != '.svn') {

            $load = $path.'/'.$value;
            if(is_dir($load)) {
                /** Directory **/
                require_once $load.'/index.php';
            } elseif(is_file($load)) {
                /** Files **/
                require_once $load;
            }
        }
    }

}

?>
